import React, { Component } from 'react';

import Myclschild1 from './Myclschild1';
import Myclschild2 from './Myclschild2';
class Mycls extends Component {
    state = {
        salary1: 20,
        salary2: 10
    }
    render() {
        const { salary1, salary2 } = this.state
        return (
            <div>
                {/* 使用组件1--江鹏杰 */}
                <Myclschild1 salary1={salary1}></Myclschild1>
                <button onClick={() => {
                    this.setState({
                        salary1: salary1 + 1
                    })
                }}>给江鹏杰加薪水+1</button>
                {/* 使用子组件2--王广宇 */}
                <Myclschild2 salary2={salary2}></Myclschild2>
                <button onClick={() => {
                    this.setState({
                        salary2: salary2 + 2
                    })
                }}>给王广宇加薪水+2</button>
            </div>
        );
    }
}

export default Mycls;
